#coding:utf-8

import time,os,uuid,json,sys
from app import db
from app.admin import admin
from flask import request, jsonify,session,g,current_app
from werkzeug.utils import secure_filename
from app.models import Goods,User,Order
from app.func.token_auth import auth as http_auth
from response_code import RET


UP_LOAD='app/static/upload/image'
SAVE_PATH='../static/upload/image'
DIR=os.path.join(os.getcwd(),UP_LOAD)

@admin.route("/upload_img",methods=['POST'])
def upload_img():
    fobject=request.files.get('file')
    img_path=os.path.join(DIR,fobject.filename)
    print(img_path)
    fobject.save(img_path)
    save_path=os.path.join(SAVE_PATH,fobject.filename)
    return jsonify(code=0,msg="上传图片成功",img_path="https://s3.ax1x.com/2020/11/21/D1b1xA.jpg")


